package main

func main() {
	//timeObj := time.Now()
	//fmt.Println(timeObj)
	//
	//fmt.Printf("%02d-%02d-%02d %02d-%02d-%02d\n", timeObj.Year(), timeObj.Month(), timeObj.Day(), timeObj.Hour(), timeObj.Minute(), timeObj.Second())
	//fmt.Println(timeObj.Format("2006-01-02 15:04:05.123"))
	//fmt.Println(timeObj.Format("2006/01/02 15:04:05.123"))
	//
	//// 时间戳
	//fmt.Println(timeObj.Unix())
	//fmt.Println(timeObj.UnixMilli())
	//fmt.Println(timeObj.UnixNano())
	//
	//// 时间戳转为日期字符串
	//time2 := time.Unix(timeObj.Unix(), 0)
	//fmt.Println(time2.Format("2006-01-02 15:04:05.123"))
	//
	//// 日期字符串转为时间戳
	//time3, err := time.ParseInLocation("2006-01-02 15:04:05", "2025-01-01 00:00:00", time.Local)
	//fmt.Println(time3, err)

	//time4 := time.Now()
	//time4 = time4.Add(time.Hour * 2)
	//fmt.Println(time4)

	// golang定时器
	//ticker := time.NewTicker(time.Second)
	//for t := range ticker.C {
	//	fmt.Println(t)
	//}

	// 执行5次后停止
	//ticker := time.NewTicker(time.Second)
	//n := 0
	//for t := range ticker.C {
	//	if n == 5 {
	//		fmt.Println("stop")
	//		ticker.Stop()
	//		break
	//	}
	//	fmt.Println(t)
	//	n++
	//}

	//fmt.Println("aaaaa", time.Now().Second())
	//time.Sleep(time.Second)
	//fmt.Println("aaaaa", time.Now().Second())
	//time.Sleep(time.Second)
	//fmt.Println("aaaaa", time.Now().Second())
	//time.Sleep(time.Second * 5)
	//fmt.Println("aaaaa", time.Now().Second())
}
